class SingleStrokeRectComponent:

    def __init__(self, width, height, main_color, stroke_color, stroke_width, r) -> None:
        self.p_width = width
        self.p_height = height
        self.main_color = main_color
        self.stroke_color = stroke_color
        self.stroke_width = stroke_width
        self.r = r

    def width(self):
        return self.p_width
    
    def height(self):
        return self.p_height
    
    def draw(self, container, x, y):
        container.add(
            container.rect(
                insert=(x, y), 
                size=(self.p_width, self.p_height), 
                rx=self.r, 
                ry=self.r, 
                fill=self.stroke_color
            )
        )
        container.add(
            container.rect(
                insert=(x + self.stroke_width, y + self.stroke_width), 
                size=(self.p_width - 2 * self.stroke_width, self.p_height - 2 * self.stroke_width), 
                rx=self.r - self.stroke_width, 
                ry=self.r - self.stroke_width, 
                fill=self.main_color
            )
        )


class DoubleStrokeRectComponent:

    def __init__(self, width, height, main_color, stroke_color, stroke_width, r) -> None:
        self.p_width = width
        self.p_height = height
        self.main_color = main_color
        self.stroke_color = stroke_color
        self.stroke_width = stroke_width
        self.r = r

    def width(self):
        return self.p_width
    
    def height(self):
        return self.p_height
    
    def draw(self, container, x, y):
        outer = SingleStrokeRectComponent(self.p_width, self.p_height, self.stroke_color, self.main_color, self.stroke_width, self.r)
        outer.draw(container, x, y)
        container.add(
            container.rect(
                insert=(x + 2 * self.stroke_width, y + 2 * self.stroke_width), 
                size=(self.p_width - 4 * self.stroke_width, self.p_height - 4 * self.stroke_width), 
                rx=self.r - 2 * self.stroke_width, 
                ry=self.r - 2 * self.stroke_width, 
                fill=self.main_color
            )
        )